<?php

namespace common\validate;

use think\Validate;

class WorkHourRecord extends Validate
{
    // 验证规则
    protected $rule = [];


    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Save 验证场景定义
    public function sceneSave()
    {
        return $this
            ->append('data.project_id', 'require')
            ->append('data.start_time', 'require|date')
            ->append('data.end_time', 'require|date')
            ->append('data.type', 'require');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // Import 验证场景定义
    public function sceneImport()
    {
        return $this->append('data_list', 'require|array');
    }
}
